import java.io.*;

class Main {
	public static void main(String[] args) throws FileNotFoundException, IOException {
		boolean preIsBlank = true;
		boolean currentIsBlank;
		int pos = 0;
		
		int wc = 0;
		FileReader fr = new FileReader("test.txt");
		int c = fr.read();
		while (c != -1) {
			//System.out.print((char)c);
			currentIsBlank = (c == ' ' || c == '\t' || c == '\n');
			if (preIsBlank && !currentIsBlank) {
				wc++;
				System.out.println("count: " + wc + " pos: " + pos + " char: " + (char)c);
				
			}
			preIsBlank = currentIsBlank;
			pos++;
			c = fr.read();
		}

		System.out.println(wc);
		
		
	}
}
